<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SHOP 管理中心 - 品牌管理 </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="{$Think.const.ADMIN_CSS_PATH}general.css" rel="stylesheet" type="text/css" />
<link href="{$Think.const.ADMIN_CSS_PATH}main.css" rel="stylesheet" type="text/css" />
</head>
<body>

<h1>
<span class="action-span"><a href="__CONTROLLER__/brand_add">添加品牌</a></span>
<span class="action-span1"><a href="index.php?act=main">SHOP 管理中心</a> </span><span id="search_id" class="action-span1"> - 商品品牌 </span>
<div style="clear:both"></div>
</h1>

<div class="form-div">
  <form action="javascript:search_brand()" name="searchForm">
    <img src="{$Think.const.ADMIN_IMG_PATH}icon_search.gif" width="26" height="22" border="0" alt="SEARCH">
     <input type="text" name="brand_name" size="15">
    <input type="button" value=" 搜索 " class="button" onclick='fuck()';>
  </form>
</div>

<form method="post" action="" name="listForm">
<!-- start brand list -->
<div class="list-div" id="listDiv">

  <table cellpadding="3" cellspacing="1">
    <tbody>
		<tr>
			<th>品牌名称</th>
			<th>品牌网址</th>
			<th>品牌描述</th>
			<th>排序</th>
			<th>是否显示</th>
			<th>操作</th>
		</tr>
    <?php foreach($brandlist as $bl):?>
        <tr>
			<td class="first-cell"><span style="float:right"><a href="../data/brandlogo/1240803062307572427.gif" target="_brank"><img src="{$Think.const.ADMIN_IMG_PATH}picflag.gif" width="16" height="16" border="0" alt="品牌LOGO"></a></span>
			<span onclick="javascript:listTable.edit(this, 'edit_brand_name', 1)" title="点击修改内容" style=""><?php echo $bl['brand_name'];?></span>
			</td>
			<td><a href="http://www.nokia.com.cn/" target="_brank"><?php echo $bl['brand_url'];?></a></td>
			<td align="left" ><?php echo mb_substr($bl['brand_desc'],0,30,'utf8').'....';?></td>
			<td align="right"><span onclick="javascript:listTable.edit(this, 'edit_sort_order', 1)">50</span></td>
			<td align="center"><?php echo $bl['is_show']==1?'√':'×';?></td>
			<td align="center">
				<a href="__CONTROLLER__/brand_edit/brand_id/<?php echo $bl['brand_id'];?>"title="编辑">编辑</a> |
				<a href="__CONTROLLER__/brand_delete/brand_id/<?php echo $bl['brand_id'];?>" name='yc' title="移除">移除</a> 
			</td>
		</tr>
  <?php endforeach;?>
	<!--end，这些都是显示代码，没有格式化，开发时会删除 -->
    <tr>
		<td align="right" nowrap="true" colspan="6">
        <!--     <div id="turn-page">
              总计  <span id="totalRecords">11</span>
                个记录分为 <span id="totalPages">2</span>
                页当前第 <span id="pageCurrent">1</span>
                页，每页 <input type="text" size="3" id="pageSize" value="10" onkeypress="return listTable.changePageSize(event)">
                <span id="page-link">
                  <a href="javascript:listTable.gotoPageFirst()">第一页</a>
                  <a href="javascript:listTable.gotoPagePrev()">上一页</a>
                  <a href="javascript:listTable.gotoPageNext()">下一页</a>
                  <a href="javascript:listTable.gotoPageLast()">最末页</a>
                  <select id="gotoPage" onchange="listTable.gotoPage(this.value)">
        <option value="1">1</option><option value="2">2</option>          </select>
                </span>
              </div> -->

              {$page}
      </td>
    </tr>
  </tbody></table>

<!-- end brand list -->
</div>
</form>


<div id="footer">
	版权所有 &copy;  </div>
</div>

</body>
</html>

<script type="text/javascript">
  
  var yc = document.getElementsByName('yc');

    for(var i=0;i<yc.length;i++){

        yc[i].onclick = function()
        {
            if(confirm('你确定要删除么?'))
            {
              var url = this.href;
              console.log(url);
              this.href = '';

              var xhr = new XMLHttpRequest();

                xhr.onreadystatechange =function ()
                {
                    if(this.readyState == 4)
                    {
                        alert(JSON.parse(this.responseText));
                    }
                }

                xhr.open('get',url,false);
                this.href = '__CONTROLLER__/brand_list';

                xhr.send(null);
            }
            else
            {
                return false;
            }
        }
    }

    function fuck()
    {
        var search = document.getElementsByName('brand_name')[0].value;

        var url ="http://22.com/Admin/Brand/brand_list/brand_name/"+search;

        window.location.href = url;
    }
</script>